import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/tour_order";

export const create_order_api = (data: any, showError = true) => {
  return Http.post<{ pre_order_id: string }>(
    `/v2${baseUrl}/create_order`,
    data
  ).catch((error: Error) => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};
